package com.shenghua;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.PropertySource;

/**
 * Created by Administrator on 2018/12/18.
 */
@SpringBootApplication
@ComponentScan(basePackages = {"com.shenghua.*"})
@PropertySource("classpath:/application-config.yml")
//@MapperScan({"com.shenghua.dao.mapper","com.shenghua.dao.mapperX"})
//@EnableAutoConfiguration
public class SherpApplication extends SpringBootServletInitializer {
    // SpringBootServletInitializer 这个类的作用与在web.xml中
    // 配置负责初始化Spring应用上下文的监听器作用类似，
    // 如果需要打成war部署在tomcat下则需要
    public static Logger logger = LoggerFactory.getLogger(SherpApplication.class);

    public static void main(String[] args) {
        logger.info("back system start 后台--------服务启动");
        //SpringApplication.run(SherpApplication.class, args);
        new SpringApplicationBuilder()
                .sources(SherpApplication.class)
                .bannerMode(Banner.Mode.OFF)
                .run(args);
        System.setProperty("spring.devtools.restart.enabled", "true");
        logger.info( "Hello World!  back system start success 服务启动成功!" );
    }

    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
        // 注意这里要指向原先用main方法执行的Application启动类
        // 相当于web.xml
        return builder.sources(SherpApplication.class);
    }

}
